package fr.generali.accueilclient.gwt.client.ui.components.tooltip;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;

public class TooltipPopupPanel extends PopupPanel implements HasHTML {

    private static TooltipPopupPanelUiBinder uiBinder = GWT.create(TooltipPopupPanelUiBinder.class);

    interface TooltipPopupPanelUiBinder extends UiBinder<Widget, TooltipPopupPanel> {
    }

    /** Le panel dans lequel on insère le contenu HTML à afficher */
    @UiField
    HTML contentPanel;

    @UiField
    Resources res;
    
    public TooltipPopupPanel() {
        setWidget(uiBinder.createAndBindUi(this));
        res.style().ensureInjected();
        setVisible(false);
    }
    
    @Override
    public String getHTML() {
        return contentPanel.getHTML();
    }

    @Override
    public void setHTML(String html) {
        contentPanel.setHTML(html);
    }

    @Override
    public String getText() {
        return getHTML();
    }

    @Override
    public void setText(String text) {
        setHTML(text);
    }
}
